window.onload = function () {
    axios.post("http://localhost:8081/user/common").then(res => {
        var username = document.getElementById("username");
        if(res.data.state){
            var admin = res.data.admin;
            username.innerText = admin.username;
        }
    })
}
function logout() {
    var flag = confirm("确定退出？");
    if(flag){
        axios.post("http://localhost:8081/admin/logout").then(res => {
            if(res.data.state){
                location.href = "../html/login.html";
            }
        })
    }
}